package com.hellobike.haxing.modules.product.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import com.hellobike.haxing.modules.product.entity.Street;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * @Description: 街道
 * @Author: haxing-boot
 * @Date:   2020-02-03
 * @Version: V1.0
 */
public interface StreetMapper extends BaseMapper<Street> {

    @Select("SELECT id, name, province_id, city_id, district_id FROM t_street WHERE district_id=#{districtId} AND EXISTS (SELECT 1 FROM t_shop WHERE street_id=t_street.id AND deleted=0)")
    List<Street> getOpenedStreetsByDistrictId(@Param("districtId") Long districtId);

    List<Street> getOpenedStreetsByDistrictIds(@Param("districtIdList") List<Long> districtIdList);
}
